<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="<?php echo C('ADMIN_CSS_URL');?>pintuer.css">
<link rel="stylesheet" href="<?php echo C('ADMIN_CSS_URL');?>admin.css">
<script src="<?php echo C('ADMIN_JS_URL');?>jquery.js"></script>
<script src="<?php echo C('ADMIN_JS_URL');?>pintuer.js"></script>
</head>
<body>
<div class="panel admin-panel">
  <div class="padding border-bottom">
    <button type="button" class="button border-yellow" onclick="window.location.href='<?php echo U('Cate/add');?>'"><span class="icon-plus-square-o"></span> 添加分类</button>
  </div>
  <table class="table table-hover text-center">
    <tr>
      <th width="5%">ID</th>
      <th width="15%">分类名称</th>
      <th width="10%">分类描述</th>
      <th width="10%">操作</th>
    </tr>
    <?php if(is_array($cate_info)): foreach($cate_info as $key=>$v): ?><tr>
            <td><?php echo ($v["cate_id"]); ?></td>
            <td><?php echo ($v["cate_name"]); ?></td>
            <td><?php echo ($v["cate_description"]); ?></td>
            <td><div class="button-group"> <a class="button border-main" href="<?php echo U('Cate/upd',array('cate_id'=>$v['cate_id']));?>"><span class="icon-edit"></span> 修改</a> <a class="button border-red" href="javascript:void(0)" onclick="if(confirm('你确定删除吗？')){del(<?php echo ($v["cate_id"]); ?>)}"><span class="icon-trash-o"></span> 删除</a> </div></td>
        </tr><?php endforeach; endif; ?>
  </table>
</div>
<script type="text/javascript">
function del(cate_id){
    $.ajax({
        url:"<?php echo U('Cate/delete');?>",
        data:{'cate_id':cate_id},
        dataType:'json',
        type:'post',
        success:function(msg){
            if(msg.status==1){
                window.location.href="<?php echo U('Cate/showlist');?>";
            }
        }
    });
}
</script>
</body>
</html>